package de.kleiza.utilities.sometimes

import de.kleiza.utilities.sometimes._
import java.util.Random

object SometimesTests2 extends Application {
  val rand = new Random(System.currentTimeMillis());

  //define a predicate
  val sometimeTrue = Pred({ () => rand.nextInt(100) == 0 })

  //sometimeTrue should be true sometime (fin = finally)
  val ltlIter = sometimeTrue fin

  //iterate through the time steps and check each timestep
  val ret: Boolean = ltlIter exists { elem =>
    elem match {
      case Result(true) => true
      case _ => false
    }
  }

  println("assertion: " + (ret == true))
}